Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 2 - Geometric Shapes / Geometric Shapes Reference
Functions / Editing Shape Geometries


GXGetShapeIndex

You can use the GXGetShapeIndex function to determine the geometry index of a geometric point.

long GXGetShapeIndex(gxShape source, long contour, long vector);
source
A reference to the shape containing the desired geometric point.
contour
The index of the contour within the shape containing the geometric point.
vector
The index of the geometric point within that contour.
function result
The geometry index of the specified geometric point.
DESCRIPTION
The GXGetShapeIndex function returns as its function result the geometry index of the geometric point in the source shape's geometry that is identified by the contour and vector parameters. The indexes you provide in the contour and vector parameters are 1-based--for example, a value of 1 for the contour parameter indicates the first contour, and value of 2 indicates the second contour, and so on.

Each geometric point in a geometry has a geometry index--if you consider a geometry as a list of geometric points starting from the first geometric point of the first contour to the last geometric point of the last contour, the geometry index of a particular geometric point is its position in this list. For example, for a shape with two contours, the first with 10 geometric points and the second with 5 geometric points, this function would return 14 if you set the contour parameter to 2 and the vector parameter to 4.

For the geometric shapes with only one contour--points, lines, curves, and rectangles-- you must pass a 1 in the contour parameter. For polygon and path shapes, the value you provide for the contour parameter must be greater than 0 and must be equal to or less than the actual number of contours in the shape. Otherwise, the function posts a contour_out_of_range warning. Similarly, the value you provide for the vector parameter must be equal to or less than the actual number of geometric points in the specified contour, or the function posts an index_out_of_range_in_contour warning and returns 0 as the function result.

If you provide a source shape that is an empty shape, a full shape, or a shape that is not one of the geometric shape types, this function posts the error graphic_type_does_not_have_multiple_contours.

ERRORS, WARNINGS, AND NOTICES
Errors 
out_of_memory 
shape_is_nil 
index_is_less_than_one(debugging version)
graphic_type_does_not_contain_points(debugging version)
graphic_type_does_not_have_multiple_contours(debugging version)
Warnings 
contour_out_of_range 
index_out_of_range_in_contour 
SEE ALSO
For a discussion of geometric points, see the section "About Geometric Shapes" beginning on page 2-5.

To determine the number of contours in a shape, use the GXCountShapeContours function, which is described on page 2-136.

To determine the number of geometric points in a contour, use the GXCountShapePoints function, which is described on page 2-137.

To copy a range of geometric points from a shape's geometry, use the GXGetShapePoints function, which is described in the next section.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help